package com.wn.servlet.req;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;

/**
 * @author yellow Docter
 * @date 2022 -06-29
 * @desc
径
 */
@WebServlet("/demo04")
public class Demo04Servlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        String name = (String) req.getAttribute("key1");
        Integer age = (Integer) req.getAttribute("key2");
        Date date = (Date) req.getAttribute("key3");

        System.out.println("name = " + name);
        System.out.println("age = " + age);
        System.out.println("date = " + date);

        //ctrl + shift + Z
        System.out.println("demo04 进行请求处理 ...");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
}

